<?php 
if ($this->ion_auth->in_group('members'))
		{
			
		}
		
?>
content
<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal">Atttendance</a>
 
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">My Attendance for <?= date('d-M-Y')?></h3>
  </div>
  <div class="modal-body">
    <p>
     <input type="hidden" value="<?= $server_time?>" id="server_time" />  
   
    <table width="100%">
  <tr>
    <td><div class="label label-success" style="display:none; font-weight:bold" id="show_entry_time"></div>
     <input type="button" value="Entry Time" name="attendance_entry" id="attendance_entry" class="btn btn-primary " />
   </td>
    <td> <input type="button" value="Exit Time" name="attendance_exit" id="attendance_exit" class="btn btn-danger span6" />
    <div class="label label-success" style="display:none; font-weight:bold" id="show_exit_time"></div>
    </td>
    <td><strong>Total Working Hours</strong> : <span id="total_working_hour">
    
    </span></td>
  </tr>
</table>
   </p>
  </div>
  
</div>
<script type="text/javascript">
	$(document).ready(function() {
$.post('<?= site_url('user/attendance/check_entry_time');?>', function(data){	
	  if(data){	 
		$('#attendance_entry').hide()		
		$('#show_entry_time').show()
		$('#show_entry_time').html("Entry Time :"+data)				
	  }	
	  else {
		$('#attendance_exit').hide()  
	  }
});	

$.post('<?= site_url('user/attendance/check_exit_time');?>', function(data){
	
	  if(data){	 
		$('#attendance_exit').hide()		
		$('#show_exit_time').show()
		$('#show_exit_time').html("Exit Time :"+data)				
	  }	
	  else {
		//$('#attendance_exit').hide()  
	  }
});	


});

// Entry time for attendance
$("#attendance_entry").click(function(){			
var server_time = $("#server_time").val();
//alert(server_time)
 $.post('<?= site_url('user/attendance/insert_entry_time');?>',{time : server_time}, function(data) {
	 alert(data)	 
	 $('#myModal').modal('hide')
	 $('#attendance_entry').hide()	
	 $('#show_entry_time').show()
	 location.reload();
	 
});
})

// exit time for attendance
$("#attendance_exit").click(function(){			
var server_time = $("#server_time").val();
//alert(server_time)

 $.post('<?= site_url('user/attendance/insert_exit_time');?>',{time : server_time}, function(data) {	 
	 if(data){
		alert(data)	
		 $.post('<?= site_url('user/attendance/insert_daily_attendance_sheet');?>', function(msg) { 
		
		if(msg)
		{
	 $('#myModal').modal('hide')
	 $('#attendance_exit').hide()	
	 location.reload();
	}
		 }); 	 
	 	 }
	 
});
})
function str()
{
alert("hello");
}
</script>